export const BASE_API = 'http://localhost:3000/api'

export const formatTime = (time: string): string => {
  return new Date(time).toLocaleDateString('zh-CN', {
    year: 'numeric',
    month: 'long',
    day: 'numeric'
  })
}

const formatDate = (date: string | null): number => {
  return date ? new Date(date).getTime() : 0
}

export const getReleaseTime = (startDate: string | null, endDate: string | null): number[] => {
  const startTimestamp = startDate ? new Date(startDate).getTime() : new Date('1970-01-01T00:00:00Z').getTime()
  const endTimestamp = endDate ? new Date(endDate).getTime() : Date.now()
  return [startTimestamp, endTimestamp]
}